<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String stagex = (String)request.getAttribute("stage");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>成绩登</title>
<link href="<%=path%>/admin/css/admin_right.css" rel="stylesheet" type="text/css" />
 <script type="text/javascript" src="<%=path%>/admin/js/check.js"></script>
 <script language="javascript">
 function calc()
 {
 var score1 = document.getElementById('score1').innerHTML;
 var score2 = document.getElementById('score2');
 if (isNaN(score2.value))
 {
    alert(score2.value+"不是数字");
 	return;
 }
 if (score2.value < 0 || score2.value > 100)
 {
    alert("成绩范围应该在0到100分");
    return;
 }
 	
 	
 var score = document.getElementById('score');
 score.value = score1 * 0.8 + score2.value * 0.2;
 }
 </script>
 
</head>

<body>
    <div class="main">
        <h1>成绩登录</h1>
        <hr/>
        <h3>评审成绩</h3>
        <table width="100%">
            <tr>
                <td class="table_head" width="100px">教师</td>
                <td class="table_head" width="100px">成绩</td>
                <td class="table_head">内部评语</td>     
                <td class="table_head">对外评语</td>    
            </tr>
            <%
                  int score = 0 ;  
                  int number = 0 ; 
                  double average = 0.0 ;         
            %>
            <s:if test="evaluateItemVOList.size()>0">
            <s:iterator id="evaluateItemVOList" value="evaluateItemVOList">
                <tr>
                <td> <s:property value="teacherName"/></td>
                <td>
                <form action="updateEvaluationOfTeacher.action" method="post" onsubmit="javascript:return checkForm(this);">
                	<input type="hidden" name="stage" value="<%=stagex%>"/>
                	<input type="hidden" name="evaluateItemID" value="<s:property value='evaluateItemID'></s:property>"/>
                    <input type="hidden" name="projectID" value="<s:property value='projectID'></s:property>"/>
                    <s:property value='grade'></s:property>
                     
                 </form></td>
                <td> <s:property value="evaluation"/></td>
                <td> <s:property value="comment"/></td>
                     <%
                        score += (Integer)request.getAttribute("grade");
                        number++ ;
                     %>
           </tr> </s:iterator>
           <%
               average = score / number ;
            %>
            </s:if>
            <s:else>            
                <tr >
                 <td colspan="4">暂无</td>
                </tr>            
            </s:else>
        </table>
        
        <h3>我的给分</h3>
        <form action="scoreAddOfManager.action" method="post" onsubmit="javascript:return checkForm(this);">
        <% 
		Integer total = (Integer)request.getAttribute("total"); 
		if(total == null)
			total = new Integer(0);
		%>
        <table align="center">
       		<%if(stagex.equals("1") || stagex.equals("3")) {%>
       		<tr>
       		     <td class = "form_strong" width="150px">教师平均分：</td>
       		     <td id="score1"><%=average%></td>
       		</tr>
            <tr>
                <td class="form_strong" width="150px">答辩成绩：</td>
                <td><input id="score2" type="text" value="0" name="answerScore" onkeyup="calc();" onblur="javascript:checkRange(this,0,100);"/></td>
            </tr>
            <%}else{ %>
            	<input type="hidden" name="answerScore" value="-1" />
            <%} %>
            <tr>
                <td class="form_strong">最终成绩：</td>
                <td><input id="score" type="text" name="phaseScore" value="<%=average%>"  onblur="javascript:checkRange(this,0,100);"/></td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                	<input type="hidden" name="projectID" value="<s:property value='projectID'></s:property>"/>
                	<input type="hidden" name="stage" value="<%=stagex%>"/>
                	<input type="submit" value="  提交  " />
                </td>
            </tr>
        </table>
        </form>
    </div>
</body>
</html>
